#ifndef DATA_REFLOW_CONFIG_MANAGER_H
#define DATA_REFLOW_CONFIG_MANAGER_H

#include "rclcpp/rclcpp.hpp"
#include "yaml-cpp/yaml.h"
#include <string>
#include <mutex>

namespace data_reflow
{
    // 单例配置管理器（全局唯一）
    class ConfigManager
    {
    public:
        static ConfigManager& get_instance();
        bool load_config(const std::string& config_path);
        bool is_loaded() const { return is_loaded_; }

        // 获取配置参数（带默认值）
        int get_int(const std::string& key, int default_val);
        bool get_bool(const std::string& key, bool default_val);
        double get_double(const std::string& key, double default_val);

    private:
        ConfigManager() = default;
        ~ConfigManager() = default;
        ConfigManager(const ConfigManager&) = delete;
        ConfigManager& operator=(const ConfigManager&) = delete;

        YAML::Node config_node_;
        bool is_loaded_ = false;
        std::mutex config_mutex_;
    };
}  // namespace data_reflow

#endif  // DATA_REFLOW_CONFIG_MANAGER_H